﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using T.FAS.Runtime.DataAccess.SQLDom;

namespace T.FAS.Runtime.DataAccess.SPI
{
    public delegate void BeforeSQLExecute();
    public delegate void ExecuteSQLSuccess(DatabaseExecuteReulst databaseExecuteReulst);

    public class DatabaseExecuteReulst
    {
        public SQLExecuteContext SQLExecuteContext { get; set; }
        /// <summary>
        /// 受影响行数
        /// </summary>
        public int AffectedRows { get; set; }

        /// <summary>
        /// 数据
        /// </summary>
        public object Data { get; set; }

        /// <summary>
        /// 查询返回dt集合
        /// </summary>
        public List<DataTable> Datas { get; set; }
    }

    public class SQLExecuteContext
    {
        /// <summary>
        /// 执行的SQL
        /// </summary>
        public string SQL { get; set; }

        /// <summary>
        /// SQL执行的参数
        /// </summary>
        public List<IDbDataParameter> Parameters { get; set; }

        /// <summary>
        /// 根据CDO解析的SQL DOM结构
        /// </summary>
        public SqlStatement SQLStatement { get; set; }

        /// <summary>
        /// sql构造信息
        /// </summary>
        public SqlBuildingInfo SqlBuildingInfo { get; set; }
    }
}
